home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / HYP / T-Z / Univ. Text Btns 1.5 / card_3180.txt < prev    next >
Text File  |  1989-02-26  |  6KB  |  226 lines

  1. -- card: 3180 from stack: in.5
  2. -- bmap block id: 2543
  3. -- flags: 0000
  4. -- background id: 2701
  5. -- name: 
  6. ----- HyperTalk script -----
  7. -----------------------------------------------------------------------
  8. --
  9. -- The BMUG trick by Raines Cohen
  10. -- Written December 20,1987 Guy Kuo
  11. -- Use this script freely but please retain the above credits
  12. --
  13. -----------------------------------------------------------------------
  14. -- If the Mouse is down and the command key is depressed and we are
  15. -- dealing with a field, the user might make a command selection
  16. -- so we had best hide the msg box.  Of course we retain all the
  17. -- msg box's current attributes and content.  Msg is emptied at this
  18. -- time to prevent spurious invocations
  19. --
  20. On MouseDown
  21.   global msgLoc,msgVis,msgContent
  22.   if the commandKey is down and the loc of msg <> "10,-100" then
  23.     put the loc of msg into msgLoc
  24.     put the visible of msg into msgVis
  25.     put target into msgContent
  26.     put msg into msgContent
  27.     set the loc of msg to 10,-100
  28.     put empty into msg
  29.   end if
  30. End MouseDown
  31.  
  32. -- Upon MouseUP with something in a hidden away msg box
  33. -- we have picked up a command selection from the user.  Do something
  34. -- with it.  In this example we put msg into a field.
  35. -- Finally, restore the msg box to its former state
  36. --
  37. On MouseUp
  38.   global msgLoc,msgVis,msgContent
  39.   if msg <> empty and the loc of msg is "10,-100" then
  40.     put msg into card field "result"
  41.     -- or do something useful with msg
  42.   end if
  43.   if the loc of msg is "10,-100" then
  44.     put msgContent into msg
  45.     set visible of msg to msgVis
  46.     set the loc of msg to msgLoc
  47.   end if
  48. End MouseUp
  49.  
  50. On Idle -- Don't forget this idle handler! It takes care of the case
  51.   -- of the user clicking on anything which has an uncooperative
  52.   -- MouseUp handler or failure of MouseUp to be sent.
  53.   -- Without this, the msg box would be "hung up"
  54.   global msgLoc,msgVis,msgContent
  55.   if (the commandKey is up) and (the loc of msg is "10,-100") then
  56.     put msgContent into msg
  57.     set visible of msg to msgVis
  58.     set the loc of msg to msgLoc
  59.   end if
  60.   pass Idle
  61. End Idle
  62. -------------------------------------------------------------------
  63. On CloseCard
  64.   put empty into card field "result"
  65. End CloseCard
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. -- part 1 (field)
  73. -- low flags: 00
  74. -- high flags: 2002
  75. -- rect: left=280 top=43 right=173 bottom=474
  76. -- title width / last selected line: 0
  77. -- icon id / first selected line: 0 / 0
  78. -- text alignment: 0
  79. -- font id: 3
  80. -- text size: 9
  81. -- style flags: 0
  82. -- line height: 12
  83. -- part name: Editable
  84.  
  85.  
  86. -- part 4 (field)
  87. -- low flags: 00
  88. -- high flags: 0002
  89. -- rect: left=45 top=216 right=254 bottom=232
  90. -- title width / last selected line: 0
  91. -- icon id / first selected line: 0 / 0
  92. -- text alignment: 1
  93. -- font id: 0
  94. -- text size: 12
  95. -- style flags: 0
  96. -- line height: 16
  97. -- part name: result
  98.  
  99.  
  100. -- part 5 (field)
  101. -- low flags: 00
  102. -- high flags: 0000
  103. -- rect: left=44 top=77 right=209 bottom=232
  104. -- title width / last selected line: 0
  105. -- icon id / first selected line: 0 / 0
  106. -- text alignment: 0
  107. -- font id: 2
  108. -- text size: 12
  109. -- style flags: 0
  110. -- line height: 16
  111. -- part name: 
  112.  
  113.  
  114. -- part 10 (button)
  115. -- low flags: 00
  116. -- high flags: 8003
  117. -- rect: left=103 top=280 right=305 bottom=182
  118. -- title width / last selected line: 0
  119. -- icon id / first selected line: 0 / 0
  120. -- text alignment: 1
  121. -- font id: 0
  122. -- text size: 12
  123. -- style flags: 0
  124. -- line height: 16
  125. -- part name: Edit Script
  126. ----- HyperTalk script -----
  127. on mouseUp
  128.   Edit script of this card
  129. end mouseUp
  130.  
  131.  
  132.  
  133. -- part 11 (button)
  134. -- low flags: 00
  135. -- high flags: 0000
  136. -- rect: left=33 top=291 right=319 bottom=58
  137. -- title width / last selected line: 0
  138. -- icon id / first selected line: 1014 / 1014
  139. -- text alignment: 1
  140. -- font id: 0
  141. -- text size: 12
  142. -- style flags: 0
  143. -- line height: 16
  144. -- part name: Prev
  145. ----- HyperTalk script -----
  146. on mouseUp
  147.   go to previous card
  148. end mouseUp
  149.  
  150.  
  151. -- part 13 (field)
  152. -- low flags: 01
  153. -- high flags: 2002
  154. -- rect: left=280 top=179 right=302 bottom=474
  155. -- title width / last selected line: 0
  156. -- icon id / first selected line: 0 / 0
  157. -- text alignment: 0
  158. -- font id: 3
  159. -- text size: 9
  160. -- style flags: 0
  161. -- line height: 12
  162. -- part name: Locked
  163.  
  164.  
  165. -- part 14 (button)
  166. -- low flags: 00
  167. -- high flags: 0000
  168. -- rect: left=207 top=292 right=319 bottom=236
  169. -- title width / last selected line: 0
  170. -- icon id / first selected line: 1012 / 1012
  171. -- text alignment: 1
  172. -- font id: 0
  173. -- text size: 12
  174. -- style flags: 0
  175. -- line height: 16
  176. -- part name: 
  177. ----- HyperTalk script -----
  178. on mouseUp
  179.   go to card id 3474
  180. end mouseUp
  181.  
  182.  
  183.  
  184.  
  185. -- part 15 (field)
  186. -- low flags: 00
  187. -- high flags: 0000
  188. -- rect: left=43 top=40 right=67 bottom=231
  189. -- title width / last selected line: 0
  190. -- icon id / first selected line: 0 / 0
  191. -- text alignment: 1
  192. -- font id: 2
  193. -- text size: 18
  194. -- style flags: 0
  195. -- line height: 24
  196. -- part name: 
  197.  
  198.  
  199. -- part contents for card part 1
  200. ----- text -----
  201. This unlocked field may be typed in at will.  
  202.  
  203. Command-select something  to see a demonstration.  Don't bounce up and down with both the command key and mouse too frequently.  Hypertalk can't keep up.
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. -- part contents for card part 5
  212. ----- text -----
  213.     This CARD has the BMUG text button script.  It works with ALL of the fields on this card.   Try COMMAND- selecting some words and the selection will appear below.
  214.  
  215.  
  216.  
  217. -- part contents for card part 13
  218. ----- text -----
  219. This Locked field also detects Command-Selects.  Try it.  The BMUG script works for both locked and unlocked fields.
  220.  
  221. Note that BMUG is faster, but the user must not move the mouse too
  222. far from the selection.
  223.  
  224. -- part contents for card part 15
  225. ----- text -----
  226. BMUG